package com.company.笔试.判断栈序列;

import java.util.Scanner;

/**
 * @author ylr
 * @version 1.0.0
 * @ClassName Main.java
 * @Description TODO
 * @createTime 2021年10月21日 20:14:00
 */
public class Main {
    public static void main(String[] args) {


    }
    public static boolean ifStack(){
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        //IOIIOIOO
        //ArrayList<Character> stack = new ArrayList<>();
        int num=0;
        for(char ch : s.toCharArray()){
            if (ch == 'O'){
                if (num<=0){
                    return false;
                }
                num--;
            }else {
                num++;
            }
        }
        if (num>0) return false;
        else return true;
    }
}
